/* 标签 */
var express = require("express");
var router = express.Router();

const labelController = require("../controller/label.js");

// 获取标签
router.get("/getLabelList", (req, res) => {
  labelController
    .getSignList()
    .then((data) => {
      res.send(JSON.stringify(data));
    })
    .catch((err) => {
      res.send(err);
    });
});

// 新增标签
router.post("/addLabel", (req, res) => {
  const data = req.body;
  labelController.addSign(data).then((result, err) => {
    if (err) {
      res.send(err);
      return;
    }
    console.log(result);
    res.send(JSON.stringify(result));
  });
});

module.exports = router;
